package com.lmx.repoDomain.tmodel;


import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiLookupIncludeAutomatically;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 老人预警表
 */
@JsonApiResource(type = "hbeaconwarning")
@Table(name = "tnb_hbeaconwarning")
@Entity
public class HbeaconWarning extends BaseEntity {

	private Employee operater;// 处理人

	private String operateNote;// 处理说明

	private Integer callTime;// 呼叫时间

	private Integer cancelTime;// 取消时间

	private Integer createDateTime;// 数据创建时间

	private String deviceId;// 按键ID 与老人按键绑定

	private Dicttype flag;// 是 否取消 cancel calling

	private Integer lastUpdateDateTime;// 更新时间

	private String reason;// 呼叫原因

	private String scannerId;// 扫描器ID 与房间绑定
	
	private Customer caller;//呼叫人    
	
	private Bed bed;
	
	private Integer operateTime;// 操作时间

	@Column(name = "operate_time")
	public Integer getOperateTime() {
		return operateTime;
	}

	public void setOperateTime(Integer operateTime) {
		this.operateTime = operateTime;
	}

	@JsonApiToOne
	@JsonApiLookupIncludeAutomatically
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "bed_id", foreignKey = @ForeignKey(name = "null"))
	public Bed getBed() {
		return bed;
	}

	public void setBed(Bed bed) {
		this.bed = bed;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "caller_id", foreignKey = @ForeignKey(name = "null"))
	public Customer getCaller() {
		return caller;
	}

	public void setCaller(Customer caller) {
		this.caller = caller;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}
  
	@Column(name = "deviceId")
	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId = deviceId;
	}

	@Column(name = "scannerId")
	public String getScannerId() {
		return scannerId;
	}

	public void setScannerId(String scannerId) {
		this.scannerId = scannerId;
	}

	@Column(name = "reason")
	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public HbeaconWarning() {
	}

	@Column(name = "callTime")
	public Integer getCallTime() {
		return callTime;
	}

	public void setCallTime(Integer callTime) {
		this.callTime = callTime;
	}

	@Column(name = "cancelTime")
	public Integer getCancelTime() {
		return cancelTime;
	}

	public void setCancelTime(Integer cancelTime) {
		this.cancelTime = cancelTime;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "flag_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getFlag() {
		return flag;
	}

	public void setFlag(Dicttype flag) {
		this.flag = flag;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "operater_id", foreignKey = @ForeignKey(name = "null"))
	public Employee getOperater() {
		return operater;
	}

	public void setOperater(Employee operater) {
		this.operater = operater;
	}

	@Column(name = "operateNote")
	public String getOperateNote() {
		return operateNote;
	}

	public void setOperateNote(String operateNote) {
		this.operateNote = operateNote;
	}

}
